/**
 * 
 */
package com.sebscape.sebcms.security.domain;

import java.io.Serializable;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.google.appengine.api.datastore.Key;
import com.sebscape.sebcms.persistence.domain.IUpdateable;

/**
 * @author Stephen
 *
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class Demographic implements Serializable, IUpdateable<Demographic> {
	
	private static final long serialVersionUID = 3237150725708083957L;
	private static Log log = LogFactory.getLog( Demographic.class );
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key id;
	
//	OneToOne (mappedBy = "demographic", cascade = CascadeType.ALL)
//	private User user;
	
	@Persistent
	private String description;
	
	@Persistent
	private String name;
	
	@Persistent
	private String specialCode;
	
	// username is stored in the superclass field "name".
	@Persistent
	private String firstname;
	@Persistent
	private String lastname;
	@Persistent
	private String emailAddress;
	@Persistent
	private String address1;
	@Persistent
	private String address2;
	@Persistent
	private String city;
	@Persistent
	private String state;
	@Persistent
	private String zip1;
	@Persistent
	private String zip2;
	@Persistent
	private String country;
	@Persistent
	private String phone1;
	@Persistent
	private String phone2;
	@Persistent
	private String phone3;
	@Persistent
	private String custom1;
	@Persistent
	private String custom2;
	@Persistent
	private String custom3;
	
	
	
	
	/**
	 * default
	 * @param username stored as the 'name' attibut of the super method.
	 * @param description
	 */
	public Demographic() {
		super();
	}

	/**
	 * Minimal constructor
	 * @param username stored as the 'name' attibut of the super method.
	 * @param description
	 */
	public Demographic(String firstname, String lastname) {
		this.firstname = firstname;
		this.lastname = lastname;
	}
	
	
	/**
	 * @param id
	 * @param user
	 * @param description
	 * @param name
	 * @param specialCode
	 * @param firstname
	 * @param lastname
	 * @param emailAddress
	 * @param address1
	 * @param address2
	 * @param city
	 * @param state
	 * @param zip1
	 * @param zip2
	 * @param country
	 * @param phone1
	 * @param phone2
	 * @param phone3
	 * @param custom1
	 * @param custom2
	 * @param custom3
	 */
	public Demographic(String description, String name,
			String specialCode, String firstname, String lastname,
			String emailAddress, String address1, String address2, String city,
			String state, String zip1, String zip2, String country,
			String phone1, String phone2, String phone3, String custom1,
			String custom2, String custom3) {
		super();
//		this.user = user;
		this.description = description;
		this.name = name;
		this.specialCode = specialCode;
		this.firstname = firstname;
		this.lastname = lastname;
		this.emailAddress = emailAddress;
		this.address1 = address1;
		this.address2 = address2;
		this.city = city;
		this.state = state;
		this.zip1 = zip1;
		this.zip2 = zip2;
		this.country = country;
		this.phone1 = phone1;
		this.phone2 = phone2;
		this.phone3 = phone3;
		this.custom1 = custom1;
		this.custom2 = custom2;
		this.custom3 = custom3;
	}

	/* (non-Javadoc)
	 * @see com.sebscape.sebcms.persistence.domain.IUpdateable#update(java.lang.Object)
	 */
	@Override
	public void update(Demographic newValues) {
		//this.user = newValues.getUser();
		this.description = newValues.getDescription();
		this.name = newValues.getName();
		this.specialCode = newValues.getSpecialCode();
		this.firstname = newValues.getFirstname();
		this.lastname = newValues.getLastname();
		this.emailAddress = newValues.getEmailAddress();
		this.address1 = newValues.getAddress1();
		this.address2 = newValues.getAddress2();
		this.city = newValues.getCity();
		this.state = newValues.getState();
		this.zip1 = newValues.getZip1();
		this.zip2 = newValues.getZip2();
		this.country = newValues.getCountry();
		this.phone1 = newValues.getPhone1();
		this.phone2 = newValues.getPhone2();
		this.phone3 = newValues.getPhone3();
		this.custom1 = newValues.getCustom1();
		this.custom2 = newValues.getCustom2();
		this.custom3 = newValues.getCustom3();
	}

	////////////////////////////////////
	// Getters and Setters
	////////////////////////////////////

	/**
	 * @return the id
	 */
	public Key getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Key id) {
		this.id = id;
	}

	/**
	 * @return the user
	 */
//	public User getUser() {
//		return user;
//	}

	/**
	 * @param user the user to set
	 */
//	public void setUser(User user) {
//		this.user = user;
//	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the specialCode
	 */
	public String getSpecialCode() {
		return specialCode;
	}

	/**
	 * @param specialCode the specialCode to set
	 */
	public void setSpecialCode(String specialCode) {
		this.specialCode = specialCode;
	}

	/**
	 * @return the firstname
	 */
	public String getFirstname() {
		return firstname;
	}

	/**
	 * @param firstname the firstname to set
	 */
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	/**
	 * @return the lastname
	 */
	public String getLastname() {
		return lastname;
	}

	/**
	 * @param lastname the lastname to set
	 */
	public void setLastname(String lastname) {
		this.lastname = lastname;
	}

	/**
	 * @return the emailAddress
	 */
	public String getEmailAddress() {
		return emailAddress;
	}

	/**
	 * @param emailAddress the emailAddress to set
	 */
	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}

	/**
	 * @return the address1
	 */
	public String getAddress1() {
		log.debug("getAddress1() called. Returning \"" + address1 + "\"");
		return address1;
	}

	/**
	 * @param address1 the address1 to set
	 */
	public void setAddress1(String address1) {
		log.debug("setAddress1( \"" + address1 + "\" ) called.");
		this.address1 = address1;
	}

	/**
	 * @return the address2
	 */
	public String getAddress2() {
		return address2;
	}

	/**
	 * @param address2 the address2 to set
	 */
	public void setAddress2(String address2) {
		this.address2 = address2;
	}

	/**
	 * @return the city
	 */
	public String getCity() {
		return city;
	}

	/**
	 * @param city the city to set
	 */
	public void setCity(String city) {
		this.city = city;
	}

	/**
	 * @return the state
	 */
	public String getState() {
		return state;
	}

	/**
	 * @param state the state to set
	 */
	public void setState(String state) {
		this.state = state;
	}

	/**
	 * @return the zip1
	 */
	public String getZip1() {
		return zip1;
	}

	/**
	 * @param zip1 the zip1 to set
	 */
	public void setZip1(String zip1) {
		this.zip1 = zip1;
	}

	/**
	 * @return the zip2
	 */
	public String getZip2() {
		return zip2;
	}

	/**
	 * @param zip2 the zip2 to set
	 */
	public void setZip2(String zip2) {
		this.zip2 = zip2;
	}

	/**
	 * @return the country
	 */
	public String getCountry() {
		return country;
	}

	/**
	 * @param country the country to set
	 */
	public void setCountry(String country) {
		this.country = country;
	}

	/**
	 * @return the phone1
	 */
	public String getPhone1() {
		return phone1;
	}

	/**
	 * @param phone1 the phone1 to set
	 */
	public void setPhone1(String phone1) {
		this.phone1 = phone1;
	}

	/**
	 * @return the phone2
	 */
	public String getPhone2() {
		return phone2;
	}

	/**
	 * @param phone2 the phone2 to set
	 */
	public void setPhone2(String phone2) {
		this.phone2 = phone2;
	}

	/**
	 * @return the phone3
	 */
	public String getPhone3() {
		return phone3;
	}

	/**
	 * @param phone3 the phone3 to set
	 */
	public void setPhone3(String phone3) {
		this.phone3 = phone3;
	}

	/**
	 * @return the custom1
	 */
	public String getCustom1() {
		return custom1;
	}

	/**
	 * @param custom1 the custom1 to set
	 */
	public void setCustom1(String custom1) {
		this.custom1 = custom1;
	}

	/**
	 * @return the custom2
	 */
	public String getCustom2() {
		return custom2;
	}

	/**
	 * @param custom2 the custom2 to set
	 */
	public void setCustom2(String custom2) {
		this.custom2 = custom2;
	}

	/**
	 * @return the custom3
	 */
	public String getCustom3() {
		return custom3;
	}

	/**
	 * @param custom3 the custom3 to set
	 */
	public void setCustom3(String custom3) {
		this.custom3 = custom3;
	}

	/**
	 * @return the serialVersionUID
	 */
	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	
}
